# -*-coding:utf-8 -*- #
# ---------------------------------------------------------------------------
# ProjectName:   selenium_self
# FileName:      main.py
# Author:       test_liu
# Datetime:     2024/8/15 下午3:57
# Description:
# ---------------------------------------------------------------------------
# from common.db import DB
from WebTest1.common.read_excel import ReadExcel
from WebTest1.page.login_page import Login
from WebTest1.page.sign_type_page import SignType


def login_test():
    # 登录自动化, 最后成功登录
    login = Login(web='e')
    excel = ReadExcel('login')
    dates = excel.get_data()
    for data in dates:
        res = login.login(data[0], data[1])
        # 断言
        if data[2] == res:
            excel.write_date(data[-1], 'pass')
        else:
            excel.write_date(data[-1], 'fail')
            login.save_screen(data[-2])


if __name__ == '__main__':
    # login_test()
    # 竞赛类型自动化-添加用例
    sign = SignType()
    excel = ReadExcel('sign_type')
    dates = excel.get_data()
    for data in dates:
        if data[1] == 'add':
            res = sign.add_sign(data[0])
        if res == data[2]:
            excel.write_date(data[-1], 'pass')
        else:
            excel.write_date(data[-1], 'fail')
            sign.save_screen(data[-2])
